import { BroadCastCall } from "../../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../../Framework/MQ/MessageBlock";
import { SPetArenaCountRewardOpen } from "../../../../../../Message/Game/SPetArenaCountRewardOpen";
import { ClockManager } from "../../../../manager/ClockManager";
import { NetDispatcher } from "../../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../../mvc/ServerCommand";
//class PetCpnCountRewardStartCommand
    
    export  class PetCpnCountRewardStartCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            super.call(arg1);
            var loc1=arg1.messageBase as SPetArenaCountRewardOpen;
            if (loc1.endDt.time - ClockManager.instance.nowDate.time > 0) 
            {
                _cache.petCompetition.isInOver = true;
            }
            else 
            {
                _cache.petCompetition.isInOver = false;
            }
            if (loc1.openDt.date != ClockManager.instance.nowDate.date) 
            {
                _cache.petCompetition.isOverDate = false;
            }
            else 
            {
                _cache.petCompetition.isOverDate = true;
            }
            NetDispatcher.dispatchCmd(ServerCommand.PetCpnCountRewardStartCommand, _cache.petCompetition.isInOver);
            return;
        }
    }
